﻿using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.Equipment.DTO;
using PowerHub.MES.DTO.Equipment.QueryDTO;
using PowerHub.MES.Entities.Equipment;
using PowerHub.MES.IServices.IEquipment;
using PowerHub.MES.ReturnEntity;

namespace PowerHub.MES.Controllers.Equipment
{

    /// <summary>
    /// 设备类别
    /// </summary>
    [ApiController]
    [Route("Api/MES/Equipment/[controller]/[action]")]
    public class EquipmentClassifyController
    {

        private IEquipment_EquipmentClassifyServices _Equipment_EquipmentClassifyServices;

        public EquipmentClassifyController(IEquipment_EquipmentClassifyServices EquipmentClassifyServices)
        {
            _Equipment_EquipmentClassifyServices = EquipmentClassifyServices;
        }

        /// <summary>
        /// 获取设备类别列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取设备类别列表")]
        public async Task<OperationPageResult<List<Equipment_EquipmentClassify>>> GetEquipment_EquipmentClassifyPageListAsync([FromBody] QueryEquipment_EquipmentClassifyDTO pageQuery)
        {
            return await _Equipment_EquipmentClassifyServices.GetEquipment_EquipmentClassifyPageListAsync(pageQuery);
        }


        /// <summary>
        /// 批量删除设备类别
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除设备类别")]
        public async Task<OperationResult<bool>> DeletionEquipment_EquipmentClassifyAsync([FromBody] List<string> Query)
        {
            return await _Equipment_EquipmentClassifyServices.DeletionEquipment_EquipmentClassifyAsync(Query);
        }

        /// <summary>
        /// 更新设备类别
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("更新设备类别")]
        public async Task<OperationResult<bool>> UpdateEquipment_EquipmentClassifyAsync([FromBody] Equipment_EquipmentClassifyDTO Query)
        {
            return await _Equipment_EquipmentClassifyServices.UpdateEquipment_EquipmentClassifyAsync(Query);
        }

        /// <summary>
        /// 添加设备类别
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加设备类别")]
        public async Task<OperationResult<bool>> CreateEquipment_EquipmentClassifyAsync([FromBody] Equipment_EquipmentClassifyDTO Query)
        {
            return await _Equipment_EquipmentClassifyServices.CreateEquipment_EquipmentClassifyAsync(Query);
        }
    }
}
